/* ----------------------------------------------------------------------
*
* Copyright (C) 2024 XiaoFei. All rights reserved.
*
* @file:		XiaoZhi_Beep.c
* @author:		XiaoFei
* @Date:     	28-April-2024
* @Revision: 	V1
* @Project: 	XiaoFei BSP Library
*
* -------------------------------------------------------------------- */

#include "stm32f4xx.h"
#include "XiaoFei_Delay.h"
#include "XiaoZhi_Beep.h"

/* 
* @function: 	GPIO_Beep_Init
*/
void GPIO_Beep_Init(void)				
{
	Beep_RCC(1);
	GPIO_InitTypeDef GPIO_InitStructure;
	GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT ;		
	GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;	
	GPIO_InitStructure.GPIO_Pin = Sig_Pin;				
	GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;		
	GPIO_InitStructure.GPIO_Speed = GPIO_High_Speed;
	GPIO_Init(Sig_GPIO,&GPIO_InitStructure);
}
	
/* 
* @function: 	Beep_ON
*/
void Beep_ON(void)
{
	Beep_Wr(Beep_EN);
}

/* 
* @function: 	Beep_OFF
*/
void Beep_OFF(void)
{
	Beep_Wr(Beep_NO);
}

/* 
* @function: 	Beep_GLIMMER
* @parameter:	[in] ms					    The number of microseconds you want to delay.
*/
void Beep_GLIMMER(int ms)
{
	Beep_Wr(Beep_EN);
	XiaoFei_Delay_ms(ms);
	Beep_Wr(Beep_NO);
	XiaoFei_Delay_ms(ms);
}

/* 
* @function: 	Beep_TURN
*/
void Beep_TURN(void)
{
	if(Beep_Rd==Beep_EN)
		Beep_Wr(Beep_NO);
	else Beep_Wr(Beep_EN);
}



